﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyBiz.Core
{
    public struct Money
    {
        private double _value;
        private ICurrency _currency;

        public static implicit operator Double(Money val)
        {
            return val._value;
        }

        public static implicit operator Money(double val)
        {
            return new Money {_value = val};
        }

        public static bool operator ==(Money m1, Money m2)
        {
            return m1._value == m2._value;
        }
        public static bool operator ==(Money m1, double m2)
        {
            return m1._value == m2;
        }

        public static bool operator !=(Money m1, double m2)
        {
            return !(m1 == m2);
        }

        public static bool operator ==(double m1, Money m2)
        {
            return m1 == m2._value;
        }

        public static bool operator !=(double m1, Money m2)
        {
            return !(m1 == m2);
        }

        public static bool operator !=(Money m1, Money m2)
        {
            return !(m1 == m2);
        }

        public static Money operator +(Money m1, Money m2)
        {
            return m1._value + m2._value;
        }
        public static Money operator +(Money m1, double m2)
        {
            return m1._value + m2;
        }
        public static Money operator +(double m1, Money m2)
        {
            return m1 + m2._value;
        }

        public static Money operator -(Money m1, Money m2)
        {
            return m1._value - m2._value;
        }
        public static Money operator -(Money m1, double m2)
        {
            return m1._value - m2;
        }
        public static Money operator -(double m1, Money m2)
        {
            return m1 - m2._value;
        }
        
        public static Money operator *(Money m1, Money m2)
        {
            return m1._value * m2._value;
        }
        public static Money operator *(Money m1, double m2)
        {
            return m1._value * m2;
        }
        public static Money operator *(double m1, Money m2)
        {
            return m1 * m2._value;
        }

        public static Money operator /(Money m1, Money m2)
        {
            return m1._value / m2._value;
        }
        public static Money operator /(Money m1, double m2)
        {
            return m1._value / m2;
        }
        public static Money operator /(double m1, Money m2)
        {
            return m1 / m2._value;
        }

    }

    public interface ICurrency
    {
    }
}
